package com.qding.park.adapter.report;

import static org.springframework.core.Ordered.HIGHEST_PRECEDENCE;

import java.util.ArrayList;
import java.util.List;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.web.HttpMessageConverters;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.web.SpringBootServletInitializer;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.annotation.Order;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;

import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.ValueFilter;
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;

@Configuration
@ComponentScan(basePackages = { 
		"com.qding.park"
		})
@ServletComponentScan
@ImportResource({ "classpath:disconf.xml" }) // 引入disconf
@PropertySource({"classpath:application.properties"})
@Order(HIGHEST_PRECEDENCE)
public class ParkReportApplication{
    
    @Bean
    public HttpMessageConverters fastJsonHttpMessageConverters() {
        List<MediaType> supportedMediaTypes = new ArrayList<MediaType>();
        supportedMediaTypes.add(MediaType.APPLICATION_JSON_UTF8);
        FastJsonHttpMessageConverter fastConverter = new FastJsonHttpMessageConverter();
        fastConverter.setSupportedMediaTypes(supportedMediaTypes);
        HttpMessageConverter<?> converter = fastConverter;
        HttpMessageConverters httpConverter = new HttpMessageConverters(converter);
        return httpConverter;

    }
	
	public static void main(String[] args) throws Exception {
		SpringApplication.run(
				ParkReportApplication.class,
				args);
		
	}

//	@Override
//	protected SpringApplicationBuilder configure(
//			SpringApplicationBuilder application) {
//		return application
//				.sources(ParkReportApplication.class);
//	}

}
